function testTabPage() {	
	var dom = $("<div>1</div>").get(0);
	
	var page = new zxt.ui.TabPage("tab1", "name1", dom );
	assertEquals("", "name1", page._title);
	
	page = new zxt.ui.TabPage("tab1", undefined, dom );
	assertEquals("", "tab1", page._title);
	
}	

function testTabPanel$Render() {	
	var tabPanel = new zxt.ui.TabPanel();
	
	var page1 = $("<div>ABCDEFG</div>").get(0);
	var page2 = $("<div>HIJKLMN</div>").get(0);
	
	tabPanel.add("tab1", page1);
	tabPanel.add("tab2", page2);
	
	var sel = tabPanel._select._label;
	assertEquals("", "tab1", sel);
	
	var dom = tabPanel.render();
	
	/* verify tab headers */
	var sHeader = $("li.tabs-selected", dom );
	assertEquals("", 1, sHeader.size());
	var spans = $( "span" , sHeader);
	assertEquals("span count", 1, spans.size());
	var content = spans.html();
	assertEquals("tab1", "tab1", content);	
	
	var nHeader = $("li:not(.tabs-selected)", dom );
	assertEquals("Not Select Headers", 1, nHeader.size());
	
	/* verify tab content */
	var content = $(">div>div", dom );
	assertEquals("", 2, content.size());	
	
	content.each( function( idx, dom ){		
		var prop = $(dom).css("display");
		if ( prop == "none" ){
			assertEquals("", "HIJKLMN", $(dom).html());	
		} else {
			assertEquals("", "ABCDEFG", $(dom).html());	
		}	
		
	});
	
	/* verfiy event */
	var t = 0;
	tabPanel.tabClick = function(){ t++; };
	sHeader.click();
	assertEquals("", 1, t);
	nHeader.click();	
	assertEquals("", 2, t);
};

function testTabPanel$ShowTab() {
	
	var tabPanel = new zxt.ui.TabPanel();
	
	var page1 = $("<div>ABCDEFG</div>").get(0);
	var page2 = $("<div>HIJKLMN</div>").get(0);
	
	tabPanel.add("tab1", page1);
	tabPanel.add("tab2", page2);
	
	var dom = tabPanel.render();
	
	var sHeader = $("li.tabs-selected", dom );
	var nHeader = $("li:not(.tabs-selected)", dom );
	
	try{
		tabPanel.showTab("tab999");
		fail("exception");
	}catch(e){
	}


	tabPanel.showTab("tab2");
	var sC = sHeader.attr("class");
	assertEquals("", undefined, sC)
	
	var nC = nHeader.attr("class");
	assertEquals("", "tabs-selected", nC)
	
}	


function testTabPanel$TabClick() {	
	var t = 0;
	var tabPanel = new zxt.ui.TabPanel();
	tabPanel._showTabPage = function(page){ t=1; }	
			
	tabPanel.tabClick();
	assertEquals("", 1, t)
}	